<template>
	<view>

		<view class="calc30 pl20 v100 pr20 overauto  bgcontain no-repeat"
			:style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
			<!-- #ifdef H5 -->
			<view class="pt20 pb20">
				<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
			</view>
			<!-- #endif -->
			<!-- #ifdef MP-WEIXIN -->
			<view class="" :style="{'paddingTop':statusBarHeigh + 'px',}">
				<view class="flex alicen pl20" :style="{'height':menuButtonInfo.height + 'px',}">
					<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
				</view>
			</view>
			<!-- #endif -->
			<view class="flex alicen fz24 col33">
				<view class="fz36 bold">志愿表</view>
				<view class="ml10">广西</view>
				<view class="">·</view>
				<view class="">物化生</view>
				<view class="">·</view>
				<view class="">{{userinfo.grade||'--'}}分</view>
				<view class="">·</view>
				<view class="">2999名</view>
			</view>
			<view class="pb20"></view>
			<view class="flex alicen between">
				<view class="fz28 bold">本科生({{list.length}}/40)</view>
				<view class="pt20 pb20 fz24 pl20 pr20 ius100 flexCenter colff bgff000">定制专属志愿表</view>
			</view>
			<view class="pb10"></view>
			<view class="pt20 mb20 pb20 pl20 pr20 flex between alicen ius10 bgfff" v-for="(item,index) in list"
				:key="index" @tap.stop="shortdetail(item.id,index+1)">
				<view class="fz28 col359eff">{{index + 1}}</view>
				<view class="fz28 col359eff">{{item.provinceName}}</view>
				<view class="fz28 col359eff">{{item.schoolName}}</view>
				<view class="fz28 col359eff">本科</view>
				<u-icon @click.stop="delMntbBy(item.id)" name="trash" size="20" color="#f40"></u-icon>
			</view>
			<view class="flex alicen between pt20 mb20 pb20 pl20 pr20 ius10 bgfff">
				<view class="fz30 col87">{{list.length+1}}</view>
				<view class="col40 fz28" @click.stop="addshortcur(list.length)">+添加志愿</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: {}, //顶部用户的信息
				list: []
			}
		},
		// onLoad() {
		// 	this.mntlist();
		// },
		onShow() {
			this.list = []
			this.mntlist();
		},

		methods: {
			shortdetail(id, index) {
				this.navgateTo('/pages/shortcut/majordetail', {
					id: id,
					index: index
				})
			},
			async delMntbBy(id) {
				let params = {
					id: id,
					userId: this.readData('useId')
				}
				let mntres = await this.request.get('/api/delMntbById', {
					params
				})
				if (mntres.code == 200) {
					this.successToShow(mntres.mag || '删除成功', call => {
						this.list = []
						this.mntlist();
					})
				}
			},
			//请求填报列表
			async mntlist() {
				let params = {
					userId: this.readData('useId')
				}
				let mnt = await this.request.get('/api/getMntbList', {
					params
				})
				if (mnt.code == 200) {
					this.userinfo = mnt.data.member
					this.list = mnt.data && mnt.data.list
					console.log('mnt', this.list)
				}
			},
			addshortcur(length) {
				this.navgateTo('/pages/shortcut/addshort', {
					length: length + 1
				})
			}
		}
	}
</script>

<style lang="scss">
	.calc150 {
		height: calc(100vh - 30rpx)
	}
</style>